package jp.fsoriented.toishi;

import jp.fsoriented.toishi.util.L;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.webkit.WebView;

import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;

/**
 * Toishiについての画面
 *
 * @author LapisCactus
 *
 */
public class AboutToishiActivity extends SherlockActivity {

	/**
	 * AboutToishiActivityに遷移する
	 *
	 * @param context
	 */
	public static final void start(Context context) {
		Intent intent = new Intent();
		intent.setClass(context, AboutToishiActivity.class);
		context.startActivity(intent);
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		L.onCreate("About");
		setContentView(R.layout.activity_about);
		// ActionBar設定
		ActionBar abar = getSupportActionBar();
		abar.setDisplayHomeAsUpEnabled(true);// onOptionsItemSelectedでR.id.homeがイベントで通知されるようになる
	}

	@Override
	protected void onResume() {
		super.onResume();
		WebView web = (WebView)findViewById(R.id.activity_about_webview);
		web.loadUrl("file:///android_asset/about.html");
	}

	@Override
	protected void onDestroy() {
		super.onDestroy();
		L.onDestroy("About");
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		return super.onCreateOptionsMenu(menu);
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		int id = item.getItemId();
		switch (id) {
		case android.R.id.home:
			L.d("Back selected.");
			finish();
			break;
		}
		return super.onOptionsItemSelected(item);
	}

}
